import { createStore, applyMiddleware } from 'redux';
import { createLogger } from 'redux-logger'
import rootReducer from './reducers';
import createSagaMiddleware from 'redux-saga';
import SAGAS from './sagaConfig';

const loggerMiddleware = createLogger();
const sagaMiddleware = createSagaMiddleware(SAGAS);

export default createStore(
    rootReducer,
    applyMiddleware(
        loggerMiddleware,
        sagaMiddleware
    )
);//生成store

//运行saga
SAGAS.forEach(saga => sagaMiddleware.run(saga))